package com.bchun.gamepk.dao;

import java.io.Serializable;

import org.springframework.dao.DataAccessException;

import com.bchun.gamepk.model.Page;

/**
 * <pre>
 * FutureSoftware
 * 
 * File: IBaseDao.java
 * 
 * Copyright (C) By PeterFeng at 2013
 * 
 * Description: 
 * 
 * Notes:
 * 
 * Revision History
 * Date          Name         Desc
 * 2013年9月20日         PeterFeng    Initial design
 * 
 * </pre>
 */
public interface IBaseDao<T> {

	/**
	 * 根据Model删除记录
	 * 
	 * @param model
	 * @throws DataAccessException
	 */
	public void delete(T model) throws DataAccessException;

	/**
	 * 根据ID删除记录
	 * 
	 * @param id
	 * @return
	 * @throws DataAccessException
	 */
	public int deleteById(Object id) throws DataAccessException;

	/**
	 * 插入对象
	 * 
	 * @param model
	 * @return
	 * @throws DataAccessException
	 */
	public Object insert(T model) throws DataAccessException;

	/**
	 * 根据ID查询对象
	 * 
	 * @param id
	 * @return
	 */
	public T getById(Class<T> cls, Serializable id);

	/**
	 * 分页查询对象
	 * 
	 * @param page
	 * @return
	 */
	public Page<T> selectByPage(Page<T> page);

	/**
	 * 更新对象
	 * 
	 * @param model
	 * @throws DataAccessException
	 */
	public void update(T model) throws DataAccessException;

}
